<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');

//判断是否领取
	$sqlt = "SELECT * from tbl_tenred  where uid='".$_COOKIE['userid']."' ";
    $queryt=mysql_query($sqlt);
    $rowt=mysql_fetch_array($queryt);


?>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>扫码领取红包-众晒网</title>
    <link rel="stylesheet" type="text/css" href="/ui/css/Hui.css" />
    <script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>
    <link href="/ui/layer/mobile/need/layer.css?2.0" type="text/css" rel="styleSheet" id="layermcss">
    <script type="text/javascript" src="/ui/xianzhi/js/jquery.min.js"></script>
    <style type="text/css">
   img {
    border-style: none;
    margin: 0px -39%;
}
    .btnling {
    position: fixed;
    top: 68%;
    left: 26%;
    width: 46%;
    background: #fe6366;
    border-radius: 15px;
    border: 0;
    height: 37px;
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    } 
	
	.btnlingg {
    position: fixed;
    top: 68%;
    left: 26%;
    width: 46%;
    background: #9E9E9E;
    border-radius: 15px;
    border: 0;
    height: 37px;
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
}	
.layui-m-layerbtn {
    display: box;
    display: -moz-box;
    display: -webkit-box;
    width: 100%;
    height: 50px;
    line-height: 50px;
    font-size: 0;
    border-top: 1px solid #d0d0d000;
    background-color: #f2f2f200;
}
.layui-m-layerbtn span[no] {
    border-right: 1px solid #d0d0d000;
    border-radius: 0 0 0 5px;
}
.layui-m-layerbtn {
                border-top: 1px solid rgba(208, 208, 208, 0);
                background-color: rgba(242, 242, 242, 0);
            }
            .layui-m-layerbtn span[no] {
            border-right: 0px;
            border-radius: 0 0 0 5px;
            color: #FFF;
            background-image:url(images/11.png) ;
            background-size: cover;
            border-right: 1px solid #d0d0d000;
            
            }
            .layui-m-layerbtn span[yes] {
            color: #C6C6C6;
            float: left;
            position: fixed;
            top: 71px;
            right: 11px;
            }
            .layui-m-layerbtn span {
                font-size: 16px;
            }
            
            .layui-m-layer0 .layui-m-layerchild {
                width: 93%;
                max-width: 640px;
                   background-color: rgba(255, 255, 255, 0);
            }   
            .layui-m-layerbtn {
            border-top: 1px solid #d0d0d000;
            background-color: #f2f2f200;
            }
.layui-m-layerchild.layui-m-anim-up {
            background-image: url(images/112.png);
            background-size: cover;
            }
            .layui-m-layerchild {
                background-color: rgba(255, 255, 255, 0);
                border: 0;
                box-shadow: 0 0 8px rgba(0, 0, 0, 0);
            }
</style>
</head>
<body>
 
    <img src="ui/image/hbg.png" style="width: 178%;height: 515px;">
	
	  <?php if(!$rowt){ ?>
	
    <button onclick="bao()" class="btnling">点击领取红包>></button>
		<?php } ?>
	
	
	  <?php if($rowt){ ?>
	  
	  <button class="btnlingg">您已领取>></button>
	  
	 <?php } ?>
</body>
   
                    
    <script type='text/javascript'>
 function bao(){
	 
	var uid='<?=$_COOKIE['userid']?>' ;
if(uid==""){
	
layer.open({
   
    content: '<img onclick="login()" src="images/113.png" style="width: 100%;">'

    ,btn: ['<img src="images/close.png" style="width: 10%;position: fixed;bottom: 17%;left: 84%;">']
    ,yes: function(index){
      
      layer.close(index);
    }
  });	

return false;  
}
 //
	        $.ajax({
            url:'qrcode_baoapi.php',
            type:'POST',
            data:{},
        }) 
  
       .done(function(respon1) {
  
     var respon = JSON.parse(respon1);
  
  
        if (respon.code=='0') {
			
    // layer.open({
    // content: '领取成功!'
    // ,skin: 'msg'
    // ,time: 2 
  // }); 

layer.open({
   
    content: '<img onclick="my()" src="images/114.png" style="width: 100%;">'
    ,shadeClose: false
  });
  
  
  
  
        }
		
		
	 if (respon.code=='1'){
         
		    // layer.open({
    // content: '稍后再领取'
    // ,skin: 'msg'
    // ,time: 2 
  // }); 

	
alert('您已领取');	
        
        }
	 if (respon.code=='2'){	
	 
alert('写入失败');	
    
        }		
		
		
      })

 
  
 // 

  
  
  
  
   }
 
 
 //去个人中心
function my(){
	
	
 window.location.href="my.php" ;
		
}
 
//去登录
 function login(){
// layer.closeAll()
  // layer.open({
    // content: '登录后,需重新扫码方可领取红包!'
    // ,btn: ['知道了',]
    // ,yes: function(index){
     
      // layer.close(index);
    // }
  // });		
alert('登录后,需重新扫码方可领取红包!');
 window.location.href="mlogin.php" ;		
} 
</script>
</html>